package com.zmj.sy.mom.srv.aps.controller;


import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.processchain.ProcessChainAddReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.processchain.ProcessChainEditReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.processchain.ProcessChainListReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.processchain.ProcessChainListResVo;
import com.zmj.sy.mom.srv.aps.service.ProcessChainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "工序链")
@RestController
@RequestMapping("/processChain")
public class ProcessChainController {

    private final ProcessChainService processChainService;

    @ApiOperation("工序链列表")
    @GetMapping("/list")
    public BasePageResVo<ProcessChainListResVo> list(ProcessChainListReqVo reqVo){
        return processChainService.list(reqVo);
    }

    @ApiOperation("添加工序链")
    @PostMapping("/add")
    public BaseResVo add(@RequestBody ProcessChainAddReqVo reqVo){
        processChainService.add(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("修改工序链")
    @PostMapping("/edit")
    public BaseResVo edit(@RequestBody ProcessChainEditReqVo reqVo){
        processChainService.edit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("删除工序链")
    @PostMapping("/delete")
    public BaseResVo delete(@RequestBody BaseIdReqVo reqVo){
        processChainService.delete(reqVo);
        return BaseResVo.ok();
    }

}
